package vip.liux.backend.infrastructure.setting;

import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;
import vip.liux.settings.definition.ISettingDefinitionContext;
import vip.liux.settings.definition.SettingDefinition;
import vip.liux.settings.definition.SettingDefinitionProvider;

@Component
public class GlobalSettingDefinitionProvider extends SettingDefinitionProvider {

    @Override
    public void define(@NotNull ISettingDefinitionContext context) {
        initScore(context);
    }

    private void initScore(ISettingDefinitionContext context) {
        context.add(new SettingDefinition(SettingConstants.Score.Recharge.EXPIRE_TIME,
                Long.valueOf(1000 * 60 * 60 * 24).toString(),
                "充值过期时间", // displayName
                "充值过期时间的描述", // description
                true, false, false
        ));

        context.add(new SettingDefinition(SettingConstants.Score.Recharge.MAX_AMOUNT,
                "1000", // 默认值
                "最大充值金额", // displayName
                "最大充值金额的描述", // description
                true, false, false
        ));

        context.add(new SettingDefinition(SettingConstants.Score.Recharge.REFUND_EXPIRE_TIME,
                Long.valueOf(1000 * 60 * 60 * 24 * 7).toString(), // 默认值为7天
                "退款过期时间", // displayName
                "退款过期时间的描述", // description
                true, false, false
        ));

        context.add(new SettingDefinition(SettingConstants.Score.Recharge.MAX_COUNT_PER_DAY,
                "5", // 默认值
                "单日最大充值次数", // displayName
                "单日最大充值次数的描述", // description
                true, false, false
        ));

        context.add(new SettingDefinition(SettingConstants.Score.Recharge.MAX_COUNT_PER_PERSON,
                "50", // 默认值
                "单人最大充值次数", // displayName
                "单人最大充值次数的描述", // description
                true, false, false
        ));

        context.add(new SettingDefinition(SettingConstants.Score.Recharge.MIN_AMOUNT,
                "10", // 默认值
                "最小充值金额", // displayName
                "最小充值金额的描述", // description
                true, false, false
        ));
    }
}
